package com.yanqu.road.server.cmd.activity.xiuxian;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.XiuXianProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.activity.xiuxian.CrossXiuXianMgr;
import com.yanqu.road.server.manager.activity.xiuxian.activity.CrossXiuXianActivity;
import com.yanqu.road.server.protocol.CrossProtocol;

@Cmd(code = CrossProtocol.C_CROSS_XIU_XIAN_PVE_PROPERTY_CHANGE, desc = "上传用户数据")
public class CrossXiuXianPvePropertyChangeCmd extends CrossCommand {

    private int activityId;

    private XiuXianProto.CrossXiuXianPvePropertyChangeReqMsg reqMsg;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        reqMsg = XiuXianProto.CrossXiuXianPvePropertyChangeReqMsg.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CrossXiuXianActivity activity = CrossXiuXianMgr.getActivity(activityId);
        if (activity != null) {
            activity.pvePropertyChange(reqMsg);
        }
    }

    @Override
    public void sendData() {

    }
}
